package at.jaki.ubb.crawling.api;

import java.util.Collection;

import at.jaki.ubb.crawling.model.DataFinderResult;
import at.jaki.ubb.crawling.model.Target;

/**
 * Every DataFinder used by the Crawling Engine has to implement this interface.
 * The engine controls the data finder via the methods specified here.
 * 
 * @author Attila Jakabfi
 * 
 * @param <D> generic type of created raw data
 * @param <TD> generic type of created target
 * @param <TT> generic type of accepted target
 */
public interface DataFinder<D, TD, TT> {

	/**
	 * This method will be called every time, when a task need to be completed
	 * by this data finder. All the business logic must be implemented here.
	 * 
	 * @param t input parameter of the data finder
	 * @return The results
	 */
	DataFinderResult<D, TD> findData(Target<TT> t);

	/**
	 * This method will be called by the engine at startup. Used to set up user
	 * defined parameters, and perform startup actions.
	 */
	void init();

	/**
	 * This method tells the crawling engine what target types can be resolved
	 * by this data finder. Only targets with the type specified here, will be
	 * sent to this data finder.
	 * 
	 * @return A list of target types. Can't be null.
	 */
	Collection<String> getTypes();
}
